package com.ruoyi.consumer.service.impl;

import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.consumer.domain.CStatisticSumTable;
import com.ruoyi.consumer.domain.CStatisticTable;
import com.ruoyi.consumer.mapper.CStatisticSumTableMapper;
import com.ruoyi.consumer.mapper.CStatisticTableMapper;
import com.ruoyi.consumer.service.ICStatisticSumTableService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;


/**
 * 统计SUMService业务层处理
 *
 * @author YFENTEST
 * @date 2024-03-19
 */
@Service
public class CStatisticSumTableServiceImpl implements ICStatisticSumTableService {
    @Autowired
    private CStatisticSumTableMapper cStatisticSumTableMapper;
    @Autowired
    private CStatisticTableMapper cStatisticTableMapper;

    /**
     * 查询统计SUM
     *
     * @param statisticId 统计SUM主键
     * @return 统计SUM
     */
    @Override
    public CStatisticSumTable selectCStatisticSumTableByStatisticId(Integer statisticId) {
        return cStatisticTableMapper.selectCStatisticSumTableByStatisticId(statisticId);
    }

    @Override
    public List<CStatisticTable> selectYesterdayFacilitIdOrderFilledSum(CStatisticTable cStatisticTable) {
        Date updateTime = cStatisticTable.getUpdateTime();
        Integer facilitId = cStatisticTable.getFacilitId();
        List<CStatisticTable> o = cStatisticTableMapper.selectYesterdayFacilitIdOrderFilledSum(updateTime, facilitId);
        return o;
    }

    @Override
    public List<CStatisticTable> selectYesterdayFuserIdOrderFilledSum(CStatisticTable cStatisticTable) {
        Date updateTime = cStatisticTable.getUpdateTime();
        Integer fuserId = cStatisticTable.getFuserId();
        List<CStatisticTable> o = cStatisticTableMapper.selectYesterdayFuserIdOrderFilledSum(updateTime, fuserId);
        return o;
    }

    @Override
    public List<CStatisticTable> selectYesterdayUserIdOrderFilledSum(CStatisticTable cStatisticTable) {
        Date updateTime = cStatisticTable.getUpdateTime();
        Integer userId = cStatisticTable.getUserId();
        List<CStatisticTable> o = cStatisticTableMapper.selectYesterdayUserIdOrderFilledSum(updateTime, userId);
        return o;
    }

    @Override
    public List<CStatisticTable> selectYesterdayCompanyIdOrderFilledSum(CStatisticTable cStatisticTable) {
        Date updateTime = cStatisticTable.getUpdateTime();
        Integer companyId = cStatisticTable.getCompanyId();
        List<CStatisticTable> o = cStatisticTableMapper.selectYesterdayCompanyIdOrderFilledSum(updateTime, companyId);
        return o;
    }

    @Override
    public List<CStatisticTable> selectYesterdayMagngerIdOrderFilledSum(CStatisticTable cStatisticTable) {
        Date updateTime = cStatisticTable.getUpdateTime();
        Integer mangerId = cStatisticTable.getMangerId();
        List<CStatisticTable> o = cStatisticTableMapper.selectYesterdayMagngerIdOrderFilledSum(updateTime, mangerId);
        return o;
    }

    @Override
    public List<CStatisticTable> selectYesterdayLeaderIdOrderFilledSum(CStatisticTable cStatisticTable) {
        Date updateTime = cStatisticTable.getUpdateTime();
        Integer leaderId = cStatisticTable.getLeaderId();
        List<CStatisticTable> o = cStatisticTableMapper.selectYesterdayLeaderIdOrderFilledSum(updateTime, leaderId);
        return o;
    }

    @Override
    public List<CStatisticTable> selectYesterdayCarIdOrderFilledSum(CStatisticTable cStatisticTable) {
        Date updateTime = cStatisticTable.getUpdateTime();
        Integer carId = cStatisticTable.getCarId();
        List<CStatisticTable> o = cStatisticTableMapper.selectYesterdayCarIdOrderFilledSum(updateTime, carId);
        return o;
    }

    @Override
    public List<CStatisticTable> selectYesterdaySnOrderFilledSum(CStatisticTable cStatisticTable) {
        Date updateTime = cStatisticTable.getUpdateTime();
        String sn = cStatisticTable.getSn();
        List<CStatisticTable> o = cStatisticTableMapper.selectYesterdaySnOrderFilledSum(updateTime, sn);
        return o;
    }

    @Override
    public List<CStatisticTable> selectYesterdayOrderFilledSum(CStatisticTable cStatisticTable) {
        Date updateTime = cStatisticTable.getUpdateTime();
        Integer facilitId = cStatisticTable.getFacilitId();
        Integer fuserId = cStatisticTable.getFuserId();
        Integer userId = cStatisticTable.getUserId();
        Integer companyId = cStatisticTable.getCompanyId();
        Integer mangerId = cStatisticTable.getMangerId();
        Integer leaderId = cStatisticTable.getLeaderId();
        Integer carId = cStatisticTable.getCarId();
        List<CStatisticTable> o = cStatisticTableMapper.selectYesterdayOrderFilledSum(updateTime, facilitId, fuserId, userId, companyId, mangerId, leaderId, carId);
        return o;
    }


    /**
     * 查询统计SUM列表
     *
     * @param cStatisticSumTable 统计SUM
     * @return 统计SUM
     */
    @Override
    public List<CStatisticSumTable> selectCStatisticSumTableList(CStatisticSumTable cStatisticSumTable) {
        return cStatisticSumTableMapper.selectCStatisticSumTableList(cStatisticSumTable);
    }

    /**
     * 新增统计SUM
     *
     * @param cStatisticSumTable 统计SUM
     * @return 结果
     */
    @Override
    public int insertCStatisticSumTable(CStatisticSumTable cStatisticSumTable) {
        cStatisticSumTable.setCreateTime(DateUtils.getNowDate());
        return cStatisticSumTableMapper.insertCStatisticSumTable(cStatisticSumTable);
    }

    /**
     * 修改统计SUM
     *
     * @param cStatisticSumTable 统计SUM
     * @return 结果
     */
    @Override
    public int updateCStatisticSumTable(CStatisticSumTable cStatisticSumTable) {
        cStatisticSumTable.setUpdateTime(DateUtils.getNowDate());
        return cStatisticSumTableMapper.updateCStatisticSumTable(cStatisticSumTable);
    }

    /**
     * 批量删除统计SUM
     *
     * @param statisticIds 需要删除的统计SUM主键
     * @return 结果
     */
    @Override
    public int deleteCStatisticSumTableByStatisticIds(Integer[] statisticIds) {
        return cStatisticSumTableMapper.deleteCStatisticSumTableByStatisticIds(statisticIds);
    }

    /**
     * 删除统计SUM信息
     *
     * @param statisticId 统计SUM主键
     * @return 结果
     */
    @Override
    public int deleteCStatisticSumTableByStatisticId(Integer statisticId) {
        return cStatisticSumTableMapper.deleteCStatisticSumTableByStatisticId(statisticId);
    }
}
